import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import { getCategory } from '@/api/index';


export const useCounterStore = defineStore('counter', () => {
  const count = ref(0)
  const doubleCount = computed(() => count.value * 2)
  function increment() {
    count.value++
  }

  // 顶部导航 
  let list = ref([]) 
  let getList = async () => {
    let res = await getCategory()
    list.value = res.data.result
  }
  getList()
  
  return { count, doubleCount, increment,list,getList }
})
